@use "../abstracts/variables" as *;

.form {
    &__group {
        margin-bottom: 2rem;
    }

    &__input {
        font-size: 1.5rem;
        color: inherit;
        font-family: inherit;
        padding: 1.5rem 2rem;
        border-radius: 2px;
        background-color: rgba($color-white, .5);
        border: none;
        display: block;
        width: 90%;
        border-bottom: 3px solid transparent;  //加上这个可以避免显示下划线的时候抖动
        transition: all .3s;

        &:focus {
            outline: none;
            box-shadow: 0 1rem 2rem rgba($color-black,0.1);
            border-bottom: 3px solid $color-secondary-dark;
        }

        //这里设置一个验证失败的样式
        &:focus:valid {
            border-bottom: 3px solid $color-primary;
        }

        &::placeholder {
            color: $color-grey-dark-2;
        }
    }


    &__label {
        display: block;
        font-size: 1.2rem;
        font-weight: 700;
        margin-left: 2rem;
        margin-top: .7rem;
        transition: all 0.3s;
        transform: translateY(0);
    }

    //注意这个选择器，这里表示选择placeholder显示时当前元素的下一个__label元素
    &__input:placeholder-shown + &__label {
        opacity: 0;
        visibility: hidden;
        transform: translateY(-4rem);
    }

    &__radio-group {
        display: inline-block;
        width: 49%;

        // &:not(:last-child) {
        //     margin-right: 8rem;
        // }
    }

    &__radio-input {
        display: none;
    }

    //&__radio-input:checked + label>:first-child::after 这个选择器同样有效，请斟酌使用
    &__radio-input:checked ~ &__radio-label &__radio-button::after {
        opacity: 1;
    }

    &__radio-label {
        font-size: $default-font-size;
        cursor: pointer;
        position: relative;
        padding-left: 4rem;
    }

    &__radio-button {
        height: 3rem;
        width: 3rem;
        border: 5px solid $color-primary;
        border-radius: 50%;
        display: inline-block;
        position: absolute;
        // top: 50%;
        // transform: translateY(-50%);
        top: -0.4rem;
        left: 0;

        &::after {
            content: "";
            display: block;
            height: 1.3rem;
            width: 1.3rem;
            border-radius: 50%;
            background-color: $color-primary;
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%,-50%);
            opacity: 0;
            transition: all .3s;
        }
    }


}